System and method for geo-location data type searching in an on demand environment

ABSTRACT

Methods and systems are provided for retrieving, from a database containing a list of records, a subset of the list of records located within a user defined distance from a target point, each record in the list of records having a compound geo-location data type including a first data field and a second data field. The method involves generating a circle around the target point; identifying records having a geo-location within the circle; including the identified records in a result set; and presenting the result set to a user on a display screen. The method further includes treating the first data field and the second data field as a single data element.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of U.S. patentapplication Ser. No. 13/843,473, filed Mar. 15, 2013, which claims thebenefit of U.S. provisional patent application Ser. No. 61/641,955,filed Jun. 3, 2012, which are all hereby incorporated in their entiretyby reference.

TECHNICAL FIELD

Embodiments of the subject matter described herein relate generally tocomputer systems and applications for searching and sorting data basedon strongly typed compound geo-location fields and, more particularly,to a method for filtering data based on rectangular indexes to therebyreduce the overall computational complexity of the remaining distancecalculations.

BACKGROUND

Modern software development is evolving away from the client-servermodel toward network-based processing systems that provide access todata and services via the Internet or other networks. In contrast totraditional systems that host networked applications on dedicated serverhardware, a “cloud” computing model allows applications to be providedover the network “as a service” supplied by an infrastructure provider.The infrastructure provider typically abstracts the underlying hardwareand other resources used to deliver a customer-developed application sothat the customer no longer needs to operate and support dedicatedserver hardware. The cloud computing model can often provide substantialcost savings to the customer over the life of the application becausethe customer no longer needs to provide dedicated networkinfrastructure, electrical and temperature controls, physical securityand other logistics in support of dedicated server hardware.

Multi-tenant cloud-based architectures have been developed to improvecollaboration, integration, and community-based cooperation betweencustomer tenants without sacrificing data security. Generally speaking,multi-tenancy refers to a system where a single hardware and softwareplatform simultaneously supports multiple user groups (also referred toas “organizations” or “tenants”) from a common data storage element(also referred to as a “multi-tenant database”). The multi-tenant designprovides a number of advantages over conventional server virtualizationsystems. First, the multi-tenant platform operator can often makeimprovements to the platform based upon collective information from theentire tenant community. Additionally, because all users in themulti-tenant environment execute applications within a common processingspace, it is relatively easy to grant or deny access to specific sets ofdata for any user within the multi-tenant platform, thereby improvingcollaboration and integration between applications and the data managedby the various applications. The multi-tenant architecture thereforeallows convenient and cost effective sharing of similar applicationfeatures between multiple sets of users.

Cloud-based computing environments are experiencing an increasing demandfor mobile applications; that is, many users of multi-tenant and/or ondemand data services are mobile, and seek to interrogate databases whichcontain devices which are also mobile. An important component of mobileapplications involves location awareness. In order to provide a trulymobile enterprise computing platform, on demand computing providersdesire to implement geo-location support. It is further desirable toprovide users the capability to search and filter for records bylocation.

In conventional approaches, spatial options allow users to deal withlocations using specific types and indexes. Unfortunately, conventionalspatial indexes are typically domain indexes and cannot be easily mixedwith other data columns. Consequently, presently known approaches arenot adaptable to the on demand environment since a column (e.g.,organization_id) cannot be added for tenant specific data.

Systems and methods are thus needed for enabling on demand andmulti-tenant computing environments to perform queries using spatialinformation.

BRIEF DESCRIPTION OF THE DRAWING FIGURES

A more complete understanding of the subject matter may be derived byreferring to the detailed description and claims when considered inconjunction with the following figures, wherein like reference numbersrefer to similar elements throughout the figures.

FIG. 1 is a schematic block diagram of a multi-tenant computingenvironment in accordance with an embodiment;

FIG. 2 is a flow chart illustrating a method for searching geo-codeddata in a multi-tenant environment in accordance with an embodiment;

FIG. 3 is a schematic block diagram of a distance query in accordancewith an embodiment;

FIG. 4 is a conceptual block diagram illustrating a data filteringtechnique for a distance calculation query in accordance with anembodiment;

FIG. 5 is a conceptual block diagram illustrating a technique forreducing computational complexity of the distance calculation queryshown in FIG. 4 in accordance with an embodiment; and

FIG. 6 is a flow chart illustrating a method for retrieving a subset ofrecords located within a user defined distance from a target point in amulti-tenant computing environment in accordance with an embodiment; and

FIG. 7 is a schematic view of a spherical triangle.

DETAILED DESCRIPTION

Embodiments of the subject matter described herein generally relate toproviding geo-coded data in a multi-tenant database, and for searchingand sorting the geo-coded data using an algorithm which filters the dataprior to performing distance calculations on the filtered data tothereby reduce computational complexity. In an embodiment, a compounddata type is provided that includes a first data field having a firstdata type, and a second data field having a second data type. Functionsdefined over the compound data field treat the first data field and thesecond data field as a single data element. For example, one embodimentcomprises a “geo-location” compound data type that includes a first datafield “longitude” and a second data field “latitude”, expressible indecimal or degree notation (or both).

In a non-limiting example embodiment, a distance filtering mechanism isprovided for retrieving a plurality of the records within a defineddistance from a predetermined location (the target point). A circlehaving the defined radius is configured around the target point, andeach data record having a geo-location within this circle is included inthe result set.

To reduce the computational complexity associated with calculating thedistance between the target point and each data record, the coordinatesof the smallest square containing the circle are determined and anyrecords outside this square are filtered out using regular indexes onthe latitude and longitude fields of the records. In addition, thecoordinates of the biggest square within the circle are determined sothat the records inside this square are automatically included in thequery results, again using regular indexes in lieu of distancecalculations. Finally, distances are computed only for those recordshaving geo-locations falling between the first square and the secondsquare, and those records satisfying the distance criteria are added tothe final search results.

To accommodate mobile applications, the target point may correspond tothe user's past, present, or future location. Due to the temporal natureof location information the relevancy of search results may degrade overtime, so that users may be shown relatively fewer matches for mobiledevices who's location information was updated more remotely in time.

In an embodiment, a strongly typed location field is employed whichincludes a compound data definition for location. Specifically, acompound geo-location format includes both a longitude and a latitudefield, expressed in one or both of decimal and degree format (e.g.,37.7749295 or N 37° 46′ 29.7462″). Before discussing the filtering anddistance calculation algorithm in detail, a brief over of themulti-tenant will now be provided as background.

Turning now to FIG. 1, an exemplary multi-tenant system 100 includes aserver 102 that dynamically creates and supports virtual applications128 based upon data 132 from a database 130 that may be shared betweenmultiple tenants, referred to herein as a multi-tenant database. Dataand services generated by the virtual applications 128 are provided viaa network 145 to any number of client devices 140, as desired. Eachvirtual application 128 is suitably generated at run-time (or on-demand)using a common application platform 110 that securely provides access tothe data 132 in the database 130 for each of the various tenantssubscribing to the multi-tenant system 100. In accordance with onenon-limiting example, the multi-tenant system 100 is implemented in theform of an on-demand multi-tenant customer relationship management (CRM)system that can support any number of authenticated users of multipletenants.

As used herein, a “tenant” or an “organization” should be understood asreferring to a group of one or more users that shares access to commonsubset of the data within the multi-tenant database 130. In this regard,each tenant includes one or more users associated with, assigned to, orotherwise belonging to that respective tenant. Stated another way, eachrespective user within the multi-tenant system 100 is associated with,assigned to, or otherwise belongs to a particular one of the pluralityof tenants supported by the multi-tenant system 100. Tenants mayrepresent companies, corporate departments, business or legalorganizations, and/or any other entities that maintain data forparticular sets of users (such as their respective customers) within themulti-tenant system 100. Although multiple tenants may share access tothe server 102 and the database 130, the particular data and servicesprovided from the server 102 to each tenant can be securely isolatedfrom those provided to other tenants. The multi-tenant architecturetherefore allows different sets of users to share functionality andhardware resources without necessarily sharing any of the data 132belonging to or otherwise associated with other tenants.

The multi-tenant database 130 may be a repository or other data storagesystem capable of storing and managing the data 132 associated with anynumber of tenants. The database 130 may be implemented usingconventional database server hardware. In various embodiments, thedatabase 130 shares processing hardware 104 with the server 102. Inother embodiments, the database 130 is implemented using separatephysical and/or virtual database server hardware that communicates withthe server 102 to perform the various functions described herein. In anexemplary embodiment, the database 130 includes a database managementsystem or other equivalent software capable of determining an optimalquery plan for retrieving and providing a particular subset of the data132 to an instance of virtual application 128 in response to a queryinitiated or otherwise provided by a virtual application 128, asdescribed in greater detail below. The multi-tenant database 130 mayalternatively be referred to herein as an on-demand database, in thatthe multi-tenant database 130 provides (or is available to provide) dataat run-time to on-demand virtual applications 128 generated by theapplication platform 110, as described in greater detail below.

In practice, the data 132 may be organized and formatted in any mannerto support the application platform 110. In various embodiments, thedata 132 is suitably organized into a relatively small number of largedata tables to maintain a semi-amorphous “heap”-type format. The data132 can then be organized as needed for a particular virtual application128. In various embodiments, conventional data relationships areestablished using any number of pivot tables 134 that establishindexing, uniqueness, relationships between entities, and/or otheraspects of conventional database organization as desired. Further datamanipulation and report formatting is generally performed at run-timeusing a variety of metadata constructs. Metadata within a universal datadirectory (UDD) 136, for example, can be used to describe any number offorms, reports, workflows, user access privileges, business logic andother constructs that are common to multiple tenants.

Tenant-specific formatting, functions and other constructs may bemaintained as tenant-specific metadata 138 for each tenant, as desired.Rather than forcing the data 132 into an inflexible global structurethat is common to all tenants and applications, the database 130 isorganized to be relatively amorphous, with the pivot tables 134 and themetadata 138 providing additional structure on an as-needed basis. Tothat end, the application platform 110 suitably uses the pivot tables134 and/or the metadata 138 to generate “virtual” components of thevirtual applications 128 to logically obtain, process, and present therelatively amorphous data 132 from the database 130.

The server 102 may be implemented using one or more actual and/orvirtual computing systems that collectively provide the dynamicapplication platform 110 for generating the virtual applications 128.For example, the server 102 may be implemented using a cluster of actualand/or virtual servers operating in conjunction with each other,typically in association with conventional network communications,cluster management, load balancing and other features as appropriate.The server 102 operates with any sort of conventional processinghardware 104, such as a processor 105, memory 106, input/output features107 and the like. The input/output features 107 generally represent theinterface(s) to networks (e.g., to the network 145, or any other localarea, wide area or other network), mass storage, display devices, dataentry devices and/or the like.

The processor 105 may be implemented using any suitable processingsystem, such as one or more processors, controllers, microprocessors,microcontrollers, processing cores and/or other computing resourcesspread across any number of distributed or integrated systems, includingany number of “cloud-based” or other virtual systems. The memory 106represents any non-transitory short or long term storage or othercomputer-readable media capable of storing programming instructions forexecution on the processor 105, including any sort of random accessmemory (RAM), read only memory (ROM), flash memory, magnetic or opticalmass storage, and/or the like. The computer-executable programminginstructions, when read and executed by the server 102 and/or processor105, cause the server 102 and/or processor 105 to create, generate, orotherwise facilitate the application platform 110 and/or virtualapplications 128 and perform one or more additional tasks, operations,functions, and/or processes described herein. It should be noted thatthe memory 106 represents one suitable implementation of suchcomputer-readable media, and alternatively or additionally, the server102 could receive and cooperate with external computer-readable mediathat is realized as a portable or mobile component or platform, e.g., aportable hard drive, a USB flash drive, an optical disc, or the like.

The application platform 110 is any sort of software application orother data processing engine that generates the virtual applications 128that provide data and/or services to the client devices 140. In atypical embodiment, the application platform 110 gains access toprocessing resources, communications interfaces and other features ofthe processing hardware 104 using any sort of conventional orproprietary operating system 108. The virtual applications 128 aretypically generated at run-time in response to input received from theclient devices 140. For the illustrated embodiment, the applicationplatform 110 includes a bulk data processing engine 112, a querygenerator 114, a search engine 116 that provides text indexing and othersearch functionality, and a runtime application generator 120. Each ofthese features may be implemented as a separate process or other module,and many equivalent embodiments could include different and/oradditional features, components or other modules as desired.

The runtime application generator 120 dynamically builds and executesthe virtual applications 128 in response to specific requests receivedfrom the client devices 140. The virtual applications 128 are typicallyconstructed in accordance with the tenant-specific metadata 138, whichdescribes the particular tables, reports, interfaces and/or otherfeatures of the particular application 128. In various embodiments, eachvirtual application 128 generates dynamic web content that can be servedto a browser or other client program 142 associated with its clientdevice 140, as appropriate.

The runtime application generator 120 suitably interacts with the querygenerator 114 to efficiently obtain multi-tenant data 132 from thedatabase 130 as needed in response to input queries initiated orotherwise provided by users of the client devices 140. In a typicalembodiment, the query generator 114 considers the identity of the userrequesting a particular function (along with the user's associatedtenant), and then builds and executes queries to the database 130 usingsystem-wide metadata 136, tenant specific metadata 138, pivot tables134, and/or any other available resources. The query generator 114 inthis example therefore maintains security of the common database 130 byensuring that queries are consistent with access privileges granted tothe user and/or tenant that initiated the request.

With continued reference to FIG. 1, the data processing engine 112performs bulk processing operations on the data 132 such as uploads ordownloads, updates, online transaction processing, and/or the like. Inmany embodiments, less urgent bulk processing of the data 132 can bescheduled to occur as processing resources become available, therebygiving priority to more urgent data processing by the query generator114, the search engine 116, the virtual applications 128, etc.

In exemplary embodiments, the application platform 110 is utilized tocreate and/or generate data-driven virtual applications 128 for thetenants that they support. Such virtual applications 128 may make use ofinterface features such as custom (or tenant-specific) screens 124,standard (or universal) screens 122 or the like. Any number of customand/or standard objects 126 may also be available for integration intotenant-developed virtual applications 128. As used herein, “custom”should be understood as meaning that a respective object or applicationis tenant-specific (e.g., only available to users associated with aparticular tenant in the multi-tenant system) or user-specific (e.g.,only available to a particular subset of users within the multi-tenantsystem), whereas “standard” or “universal” applications or objects areavailable across multiple tenants in the multi-tenant system.

The data 132 associated with each virtual application 128 is provided tothe database 130, as appropriate, and stored until it is requested or isotherwise needed, along with the metadata 138 that describes theparticular features (e.g., reports, tables, functions, objects, fields,formulas, code, etc.) of that particular virtual application 128. Forexample, a virtual application 128 may include a number of objects 126accessible to a tenant, wherein for each object 126 accessible to thetenant, information pertaining to its object type along with values forvarious fields associated with that respective object type aremaintained as metadata 138 in the database 130. In this regard, theobject type defines the structure (e.g., the formatting, functions andother constructs) of each respective object 126 and the various fieldsassociated therewith.

Still referring to FIG. 1, the data and services provided by the server102 can be retrieved using any sort of personal computer, mobiletelephone, tablet or other network-enabled client device 140 on thenetwork 145. In an exemplary embodiment, the client device 140 includesa display device, such as a monitor, screen, or another conventionalelectronic display capable of graphically presenting data and/orinformation retrieved from the multi-tenant database 130, as describedin greater detail below.

Typically, the user operates a conventional browser application or otherclient program 142 executed by the client device 140 to contact theserver 102 via the network 145 using a networking protocol, such as thehypertext transport protocol (HTTP) or the like. The user typicallyauthenticates his or her identity to the server 102 to obtain a sessionidentifier (“SessionID”) that identifies the user in subsequentcommunications with the server 102. When the identified user requestsaccess to a virtual application 128, the runtime application generator120 suitably creates the application at run time based upon the metadata138, as appropriate.

As noted above, the virtual application 128 may contain Java, ActiveX,or other content that can be presented using conventional clientsoftware running on the client device 140; other embodiments may simplyprovide dynamic web or other content that can be presented and viewed bythe user, as desired. As described in greater detail below, the querygenerator 114 suitably obtains the requested subsets of data 132 fromthe database 130 as needed to populate the tables, reports or otherfeatures of the particular virtual application 128.

In accordance with various embodiments, application 128 may include afeature for constructing queries using geo-coordinates. In particular,the feature may facilitate calculating distances between two compounddata fields, or between a compound data field and a point. Application128 may be configured to locate all data records for a particular tenantwhich satisfy traditional search criteria, and which also lie within agiven radius from a user defined target location.

The present disclosure contemplates: i) formatting data according to astrongly typed location field (e.g., geo-coordinates); and ii) distancefiltering using the compound geo-location data. To use the querying andreporting functionality disclosed herein with “old” data which does notcomply with the compound geo-location field described herein, it is anecessary but straightforward task to convert the old data to the newstrongly typed format to include a longitude and a latitude field. In anembodiment, distance queries may be constructed using the SalesforceObject Query Language (SOQL) available at www.salesforce.com.

Referring now to FIG. 2, an exemplary method 200 for searching geo-codeddata in a multi-tenant environment is provided. More particularly, themethod 200 includes isolating (Task 202) data for a particular tenantwithin the multi-tenant database. Data records for that tenant may thenbe filtered (Task 204) by traditional search criteria to produce a firstsubset of data records. In this context, traditional search criteria mayinclude, for example, last name, title, city, company, business type,and so on. For those data records which satisfy the traditionalcriteria, a distance calculation may be performed (Task 206) between theuser defined target location and each data record, respectively, usingthe compound geo-location field associated with each data record.

Method 200 includes determining a result set (Task 208) by filteringthose records from the first subset which also satisfy the distancecriterion. The result set may then be provided (Task 210) to the user,for example, by displaying the results on a display screen.

FIG. 3 is a schematic block diagram illustrating the salient aspects ofthe method described in FIG. 2. In particular, FIG. depicts a data set302 which includes a plurality of data records for a particular tenantwithin a multi-tenant database. A circle 308, having a radius 310 and anorigin 312, represents a distance query such as “find all of my friendsthat are currently within two miles of me”, where the origin 312represents the user (“me”) and the radius 310 corresponds to the twomile user defined radius.

Data set 302 includes a plurality of data records 306 which are withinthe circle 308, as well as a plurality of data records 304 which lieoutside the circle 308. In order to reduce the computational complexityassociated with calculating distances for all of the data records 304and 308, the following filtering algorithm may be employed.

More particularly, custom fields in multi-tenant databases are managedin what are referred to as slots. Traditional custom fields use a singleslot for any data type, but geo-location data uses two slots, one forlatitude and one for longitude. These components may be exposed astraditional numeric custom fields, or together as a compound field. Inaccordance with an embodiment, a third slot or third column of data isused in connection with the geo-location data field. Specifically, oneembodiment contemplates transforming latitude and longitude into athree-dimensional coordinate system, and calculating a Euclidiandistance using the geo-location fields. The distance is then encodedinto the third custom field slot.

This may be implemented by augmenting the existing Salesforce objectquery language (SOQL) and thereby provide a new syntax for queryingrecords that are within a given distance from a target point based oninformation stored in the third column. By way of non-limiting example,consider a location field called MyLocationField. To search for recordshaving a MyLocationField within, say, ten miles from SanFrancisco(latitude 37.77; longitude −122.42), the following SOQL code may beused:

SELECT Id

FROM Account

WHERE distance(MyLocationField_c, GeoLocation(37.77, −122.42), ‘mi’<=10

The distance function can be used for filtering (in the WHERE clause),sorting (in the ORDER BY clause), and for querying (in the SELECTclause). Similarly, a user can create a formula field that usesdistance-based functions. Specifically, on the account entity, ageo-location field may be added, called MyLocationField, and a formulafield added, called MyDistance ToSanFranciscoField that may definedthrough the following formula:Distance(MyLocationField_c,Geolocation(37.77,−122.42),‘mi’).

FIG. 4 is a conceptual block diagram illustrating a filtering technique400 for retrieving a plurality of data records within a distance(radius) R from a target point 404 in accordance with an embodiment.More particularly, a circle 402 having radius R may be constructedaround the target 404. Each record having a geo-location within thecircle 402 is to be included in the result set. However, calculatingdistances for all of the data records both inside and outside the circleto determine which ones lie within the circle is computationallyintensive. Accordingly, the following shortcut which exploits thegeometric relationships between the circle, an inclusive square, and anexclusive square may be employed to reduce the computational complexityof the distance calculations.

With continued reference to FIG. 4, the coordinates of the smallestsquare 408 containing the circle 402 are determined. All of the records412 located outside this square 408 are filtered out using regularindexes on the latitude and longitude fields of the records.Significantly, this initial filtering may be accomplished without theneed for performing computationally intensive distance calculations.Rather, the latitude and longitude values for each record 412 may simplybe compared to the latitude and longitude value of square 408 to performthis high level filtering operation. Techniques for representing customfields and for using custom indexes in the context of a multi-tenantdatabase are described in: i) U.S. Patent Application No. 20130018890published Jan. 17, 2013 and entitled “Creating a Custom Index in aMulti-Tenant Database Environment”; ii) U.S. Pat. No. 8,386,471 B2issued Feb. 26, 2013 and entitled “Optimizing Queries in a Multi-tenantDatabase System Environment”; and iii) European Patent Publication No.EP2315127 A1 published Apr. 27, 2011 and entitled “Custom Entities andFields in a Multi-Tenant Database System”; the entire contents of whichare all hereby incorporated herein by this reference.

With continued reference to FIG. 4, the coordinates of the biggestsquare 406 included within the circle 402 are determined. All of therecords 410 located inside this square are automatically included in theresult set, again using regular indexes on the latitude and longitudefields of the records. As before, this filtering may be accomplishedwithout the need for performing computationally intensive distancecalculations.

Referring now to FIGS. 4 and 5, distances are computed only for thoserecords having geo-locations falling between the two squares, that is,those records within the cross-hatched region 505 which is both outsidesquare 406 and inside square 408. Based on these distance calculations,all of the records 414 which lie outside the circle 402 are excludedfrom the result set, and all of the records 416 which lie inside thecircle 402 are added to the result set to yield the final result set.

In accordance with various embodiments, any suitable technique may beused for determining distances, such as, for example, one or more of thefollowing methods: i) haversine; ii) spherical law of cosines; and iii)Euclidian distance.

More particularly, the haversine formula is an equation for calculatinggreat-circle distances between two points on a sphere from theirlongitudes and latitudes. The haversine formula is a special case of amore general formula in spherical trigonometry, the law of haversines,relating the sides and angles of spherical triangles. For any two pointson a sphere, the haversine of the central edge between them is given by:haversin(d/r)=haversin(φ₂−φ₁)+cos(φ₁)cos(φ₂)haversin(λ₂−λ₁)

where:

-   -   haversin is the haversine function:

${{haversin}(\theta)} = {{\sin^{2}( \frac{\theta}{2} )} = \frac{1 - {\cos(\theta)}}{2}}$

-   -   d is the distance between the two points (along a great circle        of the sphere; see spherical distance);    -   r is the radius of the sphere;    -   φ₁ is the latitude of point 1 and φ₂ is the latitude of point 2;        and    -   λ₁ is the longitude of point 1 and λ₂ is the longitude of point        2.

On the left side of the equals sign d/r is the central angle, measuredin radians. The distance d may be solved for by applying the inversehaversine or by using the arcsine (inverse sine) function:d=rhaversin⁻¹(h)=2r arcsin(√{square root over (h)})where h is haversin (d/r), or more explicitly:

$d = {{2r\mspace{14mu}{\arcsin( \sqrt{{{haversin}( {\phi_{2} - \phi_{1}} )} + {{\cos( \phi_{1} )}{\cos( \phi_{2} )}{{haversin}( {\lambda_{2} - \lambda_{1}} )}}} )}} = {2r\mspace{14mu}{\arcsin( \sqrt{{\sin^{2}( \frac{\phi_{2} - \phi_{1}}{2} )} + {{\cos( \phi_{1} )}{\cos( \phi_{2} )}{\sin^{2}( \frac{\lambda_{2} - \lambda_{1}}{2} )}}} )}}}$

In spherical trigonometry, the spherical law of cosines is a theoremrelating the sides and angles of spherical triangles, analogous to theordinary law of cosines from plane trigonometry. Given the unit sphereshown in FIG. 7, a “spherical triangle” on the surface of the sphere isdefined by the great circles connecting the three points u, v, and w onthe sphere. If the lengths of these three sides are a (from u to v), b(from u to w), and c (from v to w), and the angle of the corner oppositec is C, then the spherical law of cosines states:cos(c)=cos(a)cos(b)+sin(a)sin(b)cos(C)

Since this is a unit sphere, the lengths a, b, and c are simply equal tothe angles (in radians) subtended by those sides from the center of thesphere (for a non-unit sphere, they are the distances divided by theradius).

The Euclidean distance between two points p and q may be defined as thelength of the line segment connecting them (pq). In a Cartesiancoordinate system, if p=(P(longitude), P(latitude)) and q=(Q(longitude,Q(latitude)) are two points in space, then the distance D between themis given by:D=[(P _(longitude) −Q _(longitude))²+(P _(latitude) −Q_(latitude))²]^(1/2).

FIG. 6 is a flow chart illustrating a method 600 for retrieving a subsetof records located within a user defined distance from a target point ina multi-tenant computing environment. Method 600 includes formatting(Task 602) each record in the list of records with a compoundgeo-location data type including a first data field and a second datafield. Method 600 further includes constructing (Task 604) a queryincluding search criteria and a distance value; identifying (Task 606) afirst set of data for a particular tenant within the multi-tenantdatabase which satisfies the search criteria; defining (Task 608) atarget point and generating a circle having a radius R around the targetpoint; identifying a second set of data records (Task 610) having ageo-location within the circle, wherein the second set of data is asubset of the first set of data; and including the identified records ina result set and presenting the result set to a user on a display screen(Task 612).

A method is thus provided for retrieving, from a database containing alist of records, a result set of the list of records located within auser defined distance from a target point, each record in the list ofrecords having a compound geo-location data type including a first datafield and a second data field. The method includes: generating a circlearound the target point; identifying a subset of the list of recordshaving a geo-location within the circle; including the identifiedrecords in a result set; and presenting the result set to a user on adisplay screen, wherein identifying comprises treating the first datafield and the second data field as a single data element.

In an embodiment, the first and second data fields correspond tolatitude and longitude, and the target point is one of the user's past,present, and future location.

In a further embodiment, the step of identifying a subset includesdetermining the coordinates of a first square comprising the smallestdimensions which contain the circle; identifying the records outside thefirst square; and filtering out any records outside the first squarefrom the result set, wherein filtering out may be based on using regularindexes on the latitude and longitude fields of the records.

In an embodiment, identifying a subset may include determining thecoordinates of a second square comprising the largest dimensionsincluded within the circle; identifying the records within the secondsquare; and including in the result set any records within the secondsquare. Moreover, identifying the records within the second square mayinclude using regular indexes on the latitude and longitude fields ofthe records.

In another embodiment, the step of identifying records having ageo-location within the circle involves computing distances for thoserecords having geo-locations falling between the first square and thesecond square, for example, using one of: the haversine formula; thespherical law of cosines; and the Euclidian distance theorem.

In a further embodiment, the actual distance for those records lyingbetween the first and second squares is calculated, and the actualdistance for records not lying between the first and second squares isnot calculated.

In yet a further embodiment, the database comprises a multi-tenantdatabase.

In a multi-tenant computing environment of the type including amulti-tenant database, a method of searching for a subset of recordsbased on distance from a user defined target location is also provided.The method includes formatting each record in the list of records with acompound geo-location data type including a first data field and asecond data field; constructing a query including search criteria and adistance value; identifying a first set of data for a particular tenantwithin the multi-tenant database which satisfies the search criteria;defining a target point and a radius R; generating a circle having aradius R around the target point; identifying a second set of datarecords having a geo-location within the circle, wherein the second setof data is a subset of the first set of data; including the identifiedrecords in a result set; and presenting the result set to a user on adisplay screen.

In an embodiment, identifying the second set of data records involvestreating the first data field and the second data field as a single dataelement, and the first and second data fields comprise latitude andlongitude values, expressed in either decimal or degree notation.

In a further embodiment, identifying the second set of data recordsincludes determining the coordinates of a first square comprising thesmallest dimensions which contain the circle; identifying the recordsoutside the first square; and filtering out any records outside thefirst square from the result set, wherein filtering out may be based onthe use of regular indexes on the latitude and longitude fields of therecords.

In another embodiment, identifying the second set of data recordsincludes determining the coordinates of a second square comprising thelargest dimensions included within the circle; identifying the recordswithin the second square; and including in the result set all recordswithin the second square. In addition, identifying the records withinthe second square may involve using regular indexes on the latitude andlongitude fields of the records.

In another embodiment, identifying records having a geo-location withinthe circle may involve computing distances for those records havinggeo-locations falling between the first square and the second square,and wherein the actual distance for the records lying between the firstand second squares is computed, and the actual distance for thoserecords not lying between the first and second squares need not becomputed.

A computer application embodied in a non-transitory for operation by acomputer processor medium is also provided for performing the steps of:generating a circle around the target point; identifying records havinga geo-location within the circle; including the identified records in aresult set; and presenting the result set to a user on a display screen;wherein identifying comprises treating the first data field and thesecond data field as a single data element.

The foregoing description is merely illustrative in nature and is notintended to limit the embodiments of the subject matter or theapplication and uses of such embodiments. Furthermore, there is nointention to be bound by any expressed or implied theory presented inthe technical field, background, or the detailed description. As usedherein, the word “exemplary” means “serving as an example, instance, orillustration.” Any implementation described herein as exemplary is notnecessarily to be construed as preferred or advantageous over otherimplementations, and the exemplary embodiments described herein are notintended to limit the scope or applicability of the subject matter inany way.

For the sake of brevity, conventional techniques related to computerprogramming, computer networking, database querying, databasestatistics, query plan generation, XML and other functional aspects ofthe systems (and the individual operating components of the systems) maynot be described in detail herein. In addition, those skilled in the artwill appreciate that embodiments may be practiced in conjunction withany number of system and/or network architectures, data transmissionprotocols, and device configurations, and that the system describedherein is merely one suitable example. Furthermore, certain terminologymay be used herein for the purpose of reference only, and thus is notintended to be limiting. For example, the terms “first”, “second” andother such numerical terms do not imply a sequence or order unlessclearly indicated by the context.

Embodiments of the subject matter may be described herein in terms offunctional and/or logical block components, and with reference tosymbolic representations of operations, processing tasks, and functionsthat may be performed by various computing components or devices. Suchoperations, tasks, and functions are sometimes referred to as beingcomputer-executed, computerized, software-implemented, orcomputer-implemented. In this regard, it should be appreciated that thevarious block components shown in the figures may be realized by anynumber of hardware, software, and/or firmware components configured toperform the specified functions. For example, an embodiment of a systemor a component may employ various integrated circuit components, e.g.,memory elements, digital signal processing elements, logic elements,look-up tables, or the like, which may carry out a variety of functionsunder the control of one or more microprocessors or other controldevices. In this regard, the subject matter described herein can beimplemented in the context of any computer-implemented system and/or inconnection with two or more separate and distinct computer-implementedsystems that cooperate and communicate with one another. That said, inexemplary embodiments, the subject matter described herein isimplemented in conjunction with a virtual customer relationshipmanagement (CRM) application in a multi-tenant environment.

While at least one exemplary embodiment has been presented in theforegoing detailed description, it should be appreciated that a vastnumber of variations exist. It should also be appreciated that theexemplary embodiment or embodiments described herein are not intended tolimit the scope, applicability, or configuration of the claimed subjectmatter in any way. Rather, the foregoing detailed description willprovide those skilled in the art with a convenient road map forimplementing the described embodiment or embodiments. It should beunderstood that various changes can be made in the function andarrangement of elements without departing from the scope defined by theclaims, which includes known equivalents and foreseeable equivalents atthe time of filing this patent application. Accordingly, details of theexemplary embodiments or other limitations described above should not beread into the claims absent a clear intention to the contrary.

What is claimed is:
 1. A method of retrieving, from a databasecontaining a list of records, a result set of the list of recordslocated within a user defined distance from a target point, each recordin the list of records having a compound geo-location data typeincluding a latitude field and a longitude field, the method comprising:generating, with a processor, a circle around the target point with aradius corresponding to the user defined distance; identifying, with theprocessor, a result set of records having a geo-location within thecircle, wherein identifying comprises treating the first data field andthe second data field as a single data element; filtering out anyrecords outside of the circle using regular indexes on the latitude andlongitude fields of the records to form a first subset of the list ofrecords; computing distance values for each of the first subset of thelist of records using one of: the haversine formula; the spherical lawof cosines; and the Euclidian distance theorem; filtering out anyrecords from the first subset of the list of records with a respectivedistance value greater than the radius corresponding to the user defineddistance to form the result set from any remaining records; andpresenting the result set to a user on a display screen.
 2. The methodof claim 1, wherein the target point is one of the user's past, present,and future location.
 3. The method of claim 1, wherein filtering out anyrecords outside of the circle comprises: determining the coordinates ofa first square comprising the smallest dimensions which contain thecircle; identifying the records outside the first square; and filteringout any records outside the first square.
 4. The method of claim 3,wherein identifying the result set further comprises, prior to computingdistance values: determining the coordinates of a second squarecomprising the largest dimensions included within the circle;identifying the records within the second square; and including in theresult set any records within the second square.
 5. The method of claim4, wherein the identifying the records within the second squarecomprises using the regular indexes on the latitude and longitude fieldsof the records.
 6. The method of claim 4, wherein computing distancevalues comprises computing distances only for those records havinggeo-locations falling between the first square and the second square. 7.The method of claim 1, wherein the database comprises a multi-tenantdatabase.
 8. In a multi-tenant computing environment of the typeincluding a multi-tenant database, a method of searching for a subset ofrecords based on distance from a user defined target location, themethod comprising: formatting each record in the list of records with acompound geo-location data type including a first data field and asecond data field; constructing a query including search criteria and adistance value; identifying, with a processor, a first set of data for aparticular tenant within the multi-tenant database which satisfies thesearch criteria; defining, with the processor, a target point and aradius R; generating, with the processor, a circle having a radius Raround the target point; identifying, with the processor, a second setof data records having a geo-location within the circle, wherein thesecond set of data is a subset of the first set of data; including, withthe processor, the identified records in a result set; and presentingthe result set to a user on a display screen.
 9. The method of claim 8,wherein identifying the second set of data records comprises treatingthe first data field and the second data field as a single data element.10. The method of claim 9, wherein the first and second data fieldscomprise latitude and longitude.
 11. The method of claim 10, whereinidentifying the second set of data records further comprises:determining the coordinates of a first square comprising the smallestdimensions which contain the circle; identifying the records outside thefirst square; and filtering out any records outside the first squarefrom the result set.
 12. The method of claim 11, wherein filtering outcomprises filtering out using regular indexes on the latitude andlongitude fields of the records.
 13. The method of claim 12, whereinidentifying the second set of data records further comprises:determining the coordinates of a second square comprising the largestdimensions included within the circle; identifying the records withinthe second square; and including in the result set all records withinthe second square.
 14. The method of claim 13, wherein the identifyingthe records within the second square comprises using regular indexes onthe latitude and longitude fields of the records.
 15. The method ofclaim 14, wherein identifying records having a geo-location within thecircle comprises computing distances for those records havinggeo-locations falling between the first square and the second square.16. The method of claim 15, wherein the actual distance for the recordslying between the first and second squares is computed, and the actualdistance for those records not lying between the first and secondsquares is not computed.
 17. A computer application for retrieving, froma database containing a list of records, a result set of the list ofrecords located within a user defined distance from a target point, eachrecord in the list of records having a compound geo-location data typeincluding a latitude field and a longitude field, the computerapplication embodied in a non-transitory medium for operation by acomputer processor for performing the steps of: generating a circlearound the target point with a radius corresponding to the user defineddistance; identifying records having a geo-location within the circle,wherein identifying comprises treating the first data field and thesecond data field as a single data element; filtering out any recordsoutside of the circle using regular indexes on the latitude andlongitude fields of the records to form a first subset of the list ofrecords; computing distance values for each of the first subset of thelist of records using one of: the haversine formula; the spherical lawof cosines; and the Euclidian distance theorem; filtering out anyrecords from the first subset of the list of records with a respectivedistance value greater than the radius corresponding to the user defineddistance to form the result set from any remaining records; andpresenting the result set to a user on a display screen.